package org.zhouhe.vo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.OrderBy;

import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Industry entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "industry", catalog = "zpd0t1_db")
public class Industry implements java.io.Serializable {

	// Fields

	private static final long serialVersionUID = -491616627434358927L;
	private Integer industryId;
	private Industry industry;
	private String idPath;
	private String name;
	private Integer orderId;
	private Integer status;
	private Set<ArticleIndustry> articleIndustries = new HashSet<ArticleIndustry>(0);
	private Set<ReportIndustry> reportIndustries = new HashSet<ReportIndustry>(0);
	private Set<HotProject> hotProjects = new HashSet<HotProject>(0);
	private Set<Industry> industries = new HashSet<Industry>(0);
	private Set<ArticleReco> articleRecos = new HashSet<ArticleReco>(0);
	private Set<ReportReco> reportRecos = new HashSet<ReportReco>(0);

	// Constructors

	/** default constructor */
	public Industry() {
	}

	/** full constructor */
	public Industry(Industry industry, String idPath, String name, Integer orderId, Integer status, Set<ArticleIndustry> articleIndustries,
			Set<ReportIndustry> reportIndustries, Set<HotProject> hotProjects, Set<Industry> industries) {
		this.industry = industry;
		this.idPath = idPath;
		this.name = name;
		this.orderId = orderId;
		this.status = status;
		this.articleIndustries = articleIndustries;
		this.reportIndustries = reportIndustries;
		this.hotProjects = hotProjects;
		this.industries = industries;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "Industry_id", unique = true, nullable = false)
	public Integer getIndustryId() {
		return this.industryId;
	}

	public void setIndustryId(Integer industryId) {
		this.industryId = industryId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "parent_id")
	public Industry getIndustry() {
		return this.industry;
	}

	public void setIndustry(Industry industry) {
		this.industry = industry;
	}

	@Column(name = "id_path", length = 256)
	public String getIdPath() {
		return this.idPath;
	}

	public void setIdPath(String idPath) {
		this.idPath = idPath;
	}

	@Column(name = "name", length = 50)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "order_id")
	public Integer getOrderId() {
		return this.orderId;
	}

	public void setOrderId(Integer orderId) {
		this.orderId = orderId;
	}

	@Column(name = "status")
	public Integer getStatus() {
		return this.status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "industry")
	public Set<ArticleIndustry> getArticleIndustries() {
		return this.articleIndustries;
	}

	public void setArticleIndustries(Set<ArticleIndustry> articleIndustries) {
		this.articleIndustries = articleIndustries;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "industry")
	public Set<ReportIndustry> getReportIndustries() {
		return this.reportIndustries;
	}

	public void setReportIndustries(Set<ReportIndustry> reportIndustries) {
		this.reportIndustries = reportIndustries;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "industry")
	public Set<HotProject> getHotProjects() {
		return this.hotProjects;
	}

	public void setHotProjects(Set<HotProject> hotProjects) {
		this.hotProjects = hotProjects;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "industry")
	@OrderBy("orderId,industryId")
	public Set<Industry> getIndustries() {
		return this.industries;
	}

	public void setIndustries(Set<Industry> industries) {
		this.industries = industries;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "industry")
	public Set<ArticleReco> getArticleRecos() {
		return this.articleRecos;
	}

	public void setArticleRecos(Set<ArticleReco> articleRecos) {
		this.articleRecos = articleRecos;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "industry")
	public Set<ReportReco> getReportRecos() {
		return this.reportRecos;
	}

	public void setReportRecos(Set<ReportReco> reportRecos) {
		this.reportRecos = reportRecos;
	}
}